<?php
/*
 * Copyright (c) 2023. ogg. Inc. All Rights Reserved.
 * ogg sit down and start building bugs in sunny weather.
 * Author: Tc <1224663799@qq.com>.
 * LastChangeTime: 2022-08-10 02:11:20
 * ChangeTime: 2023-04-26 10:21:24
 */

declare(strict_types=1);

namespace Hesb\LaravelPlus\Exception;

use Exception;

class InvalidArgumentException extends Exception
{
    public function __construct(int $code = 400,string $message = "", Throwable $previous = null)
    {
        parent::__construct($message, $code, $previous);
    }

    /**
     * 转换异常为 HTTP 响应
     *
     * @param  \Illuminate\Http\Request $request
     * @return \Illuminate\Http\JsonResponse|\Illuminate\Http\Response
     */
    public function render($request)
    {
        return response()->json(['code' => $this->getCode(), 'msg' => $this->getMessage()]);
    }
}

